# -*- coding: utf-8 -*-

'''eof
name:企业规模
code:EB01_EnterpriseScale
tableName:
columnName:
groups:中标信息模块
dependencies:EG_DSJ
type:常用指标
datasourceType:在线指标
description:
eof'''

import sys
import re
import datetime
import  json
reload(sys)
sys.setdefaultencoding('utf-8')

null_type_list = ['', ' ', None, 'null', 'Null', 'NULL', '/', '-', '--']

def EB01_EnterpriseScale():
    try:
        #政采中标信息
        governmentProcurementInfo=json.loads(ratingRequest.get("governmentProcurementInfo"))
        # governmentProcurementInfo = ratingRequest.get("governmentProcurementInfo")
        #供应商信息
        supplierInfo=governmentProcurementInfo.get("supplierInfo")
        #企业规模
        enterpriseScale=supplierInfo[0].get("enterpriseScale")
        # print enterpriseScale
        status=["大型","中型","小型","微型","不划型"]

        if governmentProcurementInfo in null_type_list or supplierInfo in null_type_list or  enterpriseScale in null_type_list:
            return u'缺失值'
        elif enterpriseScale in status:
            return enterpriseScale
        else:
            return u'缺失值'
    except:

        return u'缺失值'

if __name__ == '__main__':
    file_obj = open(r'E:\\changjiang_bd\\EBjson20190926.json', 'r')
    content = file_obj.read()
    # ratingRequest =content
    ratingRequest = json.loads(content)
    print EB01_EnterpriseScale()


result = EB01_EnterpriseScale()

